package com.nai365.nart.ware.api.feign;

import com.nai365.nart.common.core.constant.SecurityConstants;
import com.nai365.nart.common.core.constant.ServiceNameConstants;
import com.nai365.nart.common.core.util.R;
import com.nai365.nart.common.core.vo.WareSkuVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Description:
 * @Created: with IntelliJ IDEA.
 * @author: baogs
 * @createTime: 2020-06-06 15:50
 **/

@FeignClient(ServiceNameConstants.WARE_SERVICE)
public interface WareFeignService {

    @PostMapping(value = "/waresku/hasStock")
	R getSkuHasStock(@RequestBody List<Long> skuIds, @RequestHeader(SecurityConstants.FROM) String from);
    @PostMapping(value = "/waresku/hasstock_inner")
	R getSkuHasStockInner(@RequestBody List<Long> skuIds, @RequestHeader(SecurityConstants.FROM) String from);

    @PostMapping(value = "/waresku/getListSkuStock")
	R getListSkuStock(@RequestBody List<Long> skuIds, @RequestHeader(SecurityConstants.FROM) String from);

    @PostMapping(value = "/waresku/save_inner")
	R saveWare(@RequestBody List<WareSkuVo> skuIds, @RequestHeader(SecurityConstants.FROM) String from);

	/**
	 * 每个sku的库存
	 * @param skuId
	 * @param from getstockLocked
	 * @return
	 */
	@PostMapping(value = "/waresku/getSkuStock/{id}")
	R getSkuStock(@PathVariable("id") Long skuId, @RequestHeader(SecurityConstants.FROM) String from);

	/**
	 * 查询sku的锁定库存
	 * @param skuId
	 * @return R
	 */
	@GetMapping(value = "/waresku/getStockLocked/{id}")
	R getStockLocked(@PathVariable("id") Long skuId, @RequestHeader(SecurityConstants.FROM) String from);

	/**
	 * smith
	 * 查询一部分sku的库存
	 */
	@GetMapping(value = "/waresku/getSomeSkuStock")
	R getSomeSkuStock(@RequestParam(value = "skuId",required=false) List<Long> skuId, @RequestHeader(SecurityConstants.FROM) String from);

	/**
	 * 通过skuId修改商品库存
	 * @param skuId skuId
	 * @return R
	 */
	@PostMapping("/waresku/updateBySkuId")
	R updateBySkuId(@RequestParam("skuId") Long skuId,@RequestParam("productNum") Integer productNum, @RequestHeader(SecurityConstants.FROM) String from);
}
